/* Flash OS Routines (Automagically Generated)
 * Copyright (c) 2009-2015 ARM Limited
 */
#include "flash_blob.h"

static const uint32_t flash_code[] = {
    0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
    0x49454846, 0x49466041, 0x21006041, 0x68C16001, 0x43112214, 0x69C060C1, 0xD4060740, 0x49414842,
    0x21066001, 0x49416041, 0x20006081, 0x483B4770, 0x22806901, 0x61014311, 0x47702000, 0x4837B530,
    0x241468C1, 0x60C14321, 0x25046901, 0x61014329, 0x22406901, 0x61014311, 0x4A334935, 0x6011E000,
    0x07DB68C3, 0x6901D1FB, 0x610143A9, 0x422168C1, 0x68C1D004, 0x60C14321, 0xBD302001, 0xBD302000,
    0x4926B530, 0x231468CA, 0x60CA431A, 0x2402690A, 0x610A4322, 0x69086148, 0x43102240, 0x48246108,
    0xE0004A21, 0x68CD6010, 0xD1FB07ED, 0x43A06908, 0x68C86108, 0xD0034018, 0x431868C8, 0x200160C8,
    0xB5F0BD30, 0x1C494D15, 0x68EB0849, 0x24040049, 0x60EB4323, 0x4C162714, 0x692BE01A, 0x43332601,
    0x8813612B, 0x4B108003, 0x601CE000, 0x07F668EE, 0x692BD1FB, 0x005B085B, 0x68EB612B, 0xD004423B,
    0x433868E8, 0x200160E8, 0x1C80BDF0, 0x1C921E89, 0xD1E22900, 0xBDF02000, 0x45670123, 0x40022000,
    0xCDEF89AB, 0x00005555, 0x40003000, 0x00000FFF, 0x0000AAAA, 0x00000000
};

const program_target_t flash_algo = {
    0x20000021,  // Init
    0x2000004F,  // UnInit
    0x2000005D,  // EraseChip
    0x200000A1,  // EraseSector
    0x200000E3,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0x20000001,
        0x20000C00,
        0x20001000
    },

    0x20000400,  // mem buffer location
    0x20000000,  // location to write prog_blob in target RAM
    sizeof(flash_code),  // prog_blob size
    flash_code,  // address of prog_blob
    0x00000400,  // ram_to_flash_bytes_to_be_written
};